package tmproject.hlhj.fhp.tmvote

import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.example.mymvp.BaseMvpAty
import com.example.mymvp.BasePresenter
import com.example.mymvp.BaseView
import com.gyf.barlibrary.ImmersionBar
import com.tenma.ventures.bean.utils.TMSharedPUtil
import tmproject.hlhj.fhp.tmvote.customView.LoadingDialog

/**
 * Created by Never Fear   on 2018\8\6 0006.
Never More....
 */
abstract class BaseAty<V:BaseView,P:BasePresenter<*,V>> :BaseMvpAty<V,P>(){
    lateinit var loadingDialog:LoadingDialog
    @SuppressLint("MissingSuperCall")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getContentId())
        loadingDialog=LoadingDialog(this)
        supportActionBar?.hide()
        presenter?.initView()
        presenter?.setListener()
        presenter?.logicStart()
        ImmersionBar.with(this)
                .init()

        val loBack = findViewById<LinearLayout>(R.id.loBack)
        if (null!= TMSharedPUtil.getTMThemeColor(this)&& TMSharedPUtil.getTMThemeColor(this).length>0){
            Log.e("infoo","判断颜色${this.packageName}")
            if (loBack!=null){
                loBack.setBackgroundColor(Color.parseColor(TMSharedPUtil.getTMThemeColor(this)))
            }
        }
        val btExit = findViewById<ImageView>(R.id.btExit)
        if (null!=btExit){
            btExit.setOnClickListener {
                finish()
            }
        }
    }

    abstract fun getContentId(): Int
}